<template>


         <div class="recharge">

        <div class="header"><van-nav-bar title="发起交易"  left-arrow  @click-left="$router.go(-1)" /></div>
        <div class="detail">
            <p>买入信息</p>
            <div order_info>
                <!-- <div>订单号：</div> -->
                <div>AZC≈{{data.azcInitial}}</div>
                <div>买入价格：{{data.price}}</div>
                <div>总数量：{{data.number}}</div>
             </div>
            <p >支付方式</p>
            <div  pay_type>
                <van-radio-group v-model="radio">
                    <van-radio name="1" label-position="left">USDT</van-radio>
                    <van-radio name="2" label-position="left">微信</van-radio>
                    <van-radio name="3" label-position="left">支付宝</van-radio>
                </van-radio-group>
            </div>
           <div  class="USTDPay" v-show="radio==1">
                <p>USDT付款码</p>
                <div><van-uploader v-model="USDTPic" :disabled="true" :deletable="false"  upload-text="收款码"   preview-image :max-count="1"  preview-full-image /></div>
                <!-- <p>USDT钱包地址</p>
                <div>
                    <van-cell-group>
                        <van-field v-model="USTDAdd" readonly   center clearable  placeholder="请输入USDT钱包地址">
                            <van-button slot="button" size="small" type="primary">点击复制</van-button>
                        </van-field>
                        </van-cell-group>
                </div> -->
               
                
           </div>
              <div  class="wechat_Pay"  v-show="radio==2">
                <p>微信付款码</p>
                <div style="display: flex;">
                    <van-uploader  v-model="wechatPic"  :disabled="true" upload-text="收款码" :deletable="false"   preview-image :max-count="1"  preview-full-image />
                   
                </div>
                <!-- <p>转账订单号</p>
                <div>
                    <van-cell-group>
                        <van-field v-model="wechatOrder"  center clearable   placeholder="请输入转账订单号"></van-field>
                        </van-cell-group>
                </div> -->
              
            </div>
            <div  class="aliPay"  v-show="radio==3">
                <p>支付宝付款码</p>
                <div style="display: flex;">
                    <van-uploader  v-model="aliPic"  :disabled="true" upload-text="收款码" :deletable="false"   preview-image :max-count="1"  preview-full-image />
                  
                </div>
               
              
                
           </div>
            <div class="surplus">
                    <div>交易额：{{data.usdtnumber}}</div>
                     <div v-if="data.status!=2">可用余额：{{data.usdtnumber}}</div>
                </div>
            <div class="but" v-if="istrue==0&&data.status==1">
                        <van-button @click="but"  >发起交易</van-button>
                </div>
        </div>
     </div>

</template>

<script>

export default {

data() {
    return {
              
               istrue:-1,
                radio:'1',  
                USDTPic:[ ],
                wechatPic:[],
                aliPic:[],  
                data:{},
                USTDAdd:'',  //USTD地址
                // wechatOrder:'',//微信订单号
                aliPayAccount:'',//支付宝账号
                // aliPayorder:'',//支付宝订单号
               
    }
},
mounted() { 
   let that=this;
    that.base.head_status()
    // that.show(18)
    if(that.base.empty_b(that.$route.params.id)){
         that.show(that.$route.params.id);
         
    }
  
},
 methods: {
    show(id){
         let that=this;
                var data={token:JSON.parse(localStorage.userinfo).token,id:id}
            
                       that._API.entrusshow(data).then(res => {
                           
                           
                                 if(res.code==200){
                                    that.data=res.data;
                                    that.istrue=res.istrue;
                                    that.USDTPic=[{ url: res.data.usdt_number}];
                                    that.aliPic=[{ url: res.data.alpay_number}];
                                    that.wechatPic=[{ url: res.data.wechat_number}];
                                    that.USTDAdd=res.data.usdt_addr;
                                    that.aliPayAccount=res.data.alipayaccount;
                             
                                 }else{
                                     
                                 that.$dialog.alert({title: '提示信息', message: res.msg }).then(() => { });
                                 }
                         
                          
                            
                         
                        }).catch(err => {  
                            console.log("err", err);
                        });
    },
  
    but(){
         let that=this;
        if(that.istrue==1){
            return
        }
          var data={token:JSON.parse(localStorage.userinfo).token,id:that.$route.params.id}
       
        
               
              that.$toast.loading({ message: '加载中...', forbidClick: true,overlay:true});
                       that._API.startdeal(data).then(res => {
                            that.$toast.clear();

                               that.$dialog.alert({title: '提示信息', message: res.msg }).then(() => {
                                 if(res.code==200){
                                      that.$router.go(-1)
                                 }
                        });
                          
                                
                         
                          
                            
                         
                        }).catch(err => {  
                             that.$toast.clear();
                            console.log("err", err);
                        });
        
    },

afterRead(file,detail) {
              
  
  },
     
     
 

      }
}
</script>


<style lang="scss" scoped >



    /deep/.van-nav-bar,/deep/.transfer .van-cell-group,/deep/[tab] .van-tabs__nav,/deep/.van-cell-group,/deep/.van-cell{background-color: initial;}
    /deep/.header *,/deep/.van-nav-bar .van-icon,[tab],/deep/.van-uploader__upload-text{color:white}

    .detail{padding: 0 .8rem;}  
    .detail p{line-height: 2.5rem;color:#00C6FF;}
    .detail [order_info]>div{line-height: 1.5rem;font-size: 0.9rem;}
    /deep/.detail [pay_type]>.van-radio-group{display: flex;}
    /deep/.detail [pay_type]>.van-radio-group .van-radio__label{color:white;font-size: 0.8rem;}
    /deep/.detail [pay_type]>.van-radio-group>div{padding-right: 1rem;}
    /deep/.detail .van-radio__icon .van-icon{width:1rem;height: 1rem;line-height: initial;}
    /deep/.detail .van-radio__icon{height: initial;}
    
    /deep/.van-uploader__upload{background-color: #453362;border: 0;}
    /deep/.van-cell{    background-color: #453362;    border-radius: 0rem;}
    
    /deep/.USTDPay input,/deep/.wechat_Pay input,/deep/.aliPay input{color: white;}
  
    /deep/ button{border: 0; background: #831BFA;}
    .surplus{margin: 1rem 0}
    .surplus>div{line-height: 1.5rem;height: 1.5rem;}

    .but{margin-top:2rem }
    .but button{    width: 100%;  border-radius: 3rem;}
    .but button>span{color:white}
</style>
